<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="handleClick">
      <el-tab-pane label="学员列表" name="user">
        <user ref="user"/>
      </el-tab-pane>
      <el-tab-pane label="讲师列表" name="teacher">
        <teacher ref="teacher"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
  import user from './user'
  import teacher from './teacher'

  export default {
    components: { user, teacher },
    data() {
      return {
        activeName: 'user'
      }
    },
    methods: {
      handleClick(tab, event) {
        if(this.activeName==='user'){
          this.$refs.user.init()
        }else{
          this.$refs.teacher.init()
        }

      }
    }
  }
</script>
